package com.example.neutonote2.data.model;

import androidx.room.Entity;
import androidx.room.ForeignKey;
import androidx.room.Index;

/**
 * 笔记和标签的多对多关联表
 */
@Entity(
    tableName = "note_tag_cross_ref",
    primaryKeys = {"noteId", "tagId"},
    foreignKeys = {
        @ForeignKey(
            entity = Note.class,
            parentColumns = "id",
            childColumns = "noteId",
            onDelete = ForeignKey.CASCADE
        ),
        @ForeignKey(
            entity = Tag.class,
            parentColumns = "id",
            childColumns = "tagId",
            onDelete = ForeignKey.CASCADE
        )
    },
    indices = {
        @Index("noteId"),
        @Index("tagId")
    }
)
public class NoteTagCrossRef {
    public int noteId;
    public int tagId;

    public NoteTagCrossRef(int noteId, int tagId) {
        this.noteId = noteId;
        this.tagId = tagId;
    }
} 